home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 31 / Amiga Format CD31 (1998-09-02)(Future Publishing)(GB)(Track 1 of 2)[!][issue 1998-10].iso / -websites- / sasg / dfa / rexx / dif2dfa.lha / dif2dfa.dfa
Text File  |  1995-04-30  |  2KB  |  83 lines

  1. /* $Revision Header built automatically *************** (do not edit) ************
  2. **
  3. ** © Copyright by Dirk Federlein
  4. **
  5. ** File             : dif2dfa.dfa
  6. ** Created on       : Sonntag, 30.04.95 21:59:12
  7. ** Created by       : Dirk Federlein
  8. ** Current revision : V1.0
  9. **
  10. **
  11. ** Purpose
  12. ** -------
  13. **     Import script for dif formatted files (e.g. 'Datamat')
  14. **
  15. ** Revision V1.0
  16. ** --------------
  17. ** created on Sonntag, 30.04.95 21:59:12  by  Dirk Federlein.   LogMessage :
  18. **     --- Initial release ---
  19. **
  20. *********************************************************************************/
  21.  
  22. options results
  23.  
  24. tabchar = '09'X
  25. cr        = '0A'X
  26. lf        = '0D'X
  27. quote    = '22'X
  28.  
  29. delim    = quote||tabchar||quote
  30.  
  31. importfile = 't:dfa_import.dif'
  32.  
  33. firstline    = 1
  34.  
  35. if ~show(ports, DFA) then
  36. do
  37.     exit 10
  38. end
  39.  
  40. if open('outhandle', "CON:100/50/550/300/DFA<->Arexx/CLOSE/WAIT", 'RW') = 0 then
  41.     exit
  42.  
  43. if open('imfh',importfile,'R') then
  44. do
  45.     address 'DFA'
  46.  
  47.     linenumber = 0
  48.  
  49.     do while eof('imfh') = 0
  50.         linenumber = linenumber+1
  51.  
  52.         writech('outhandle', 'Parsing line #'linenumber ': ' )
  53.  
  54.         InLine    = readln('imfh')
  55.  
  56.         if (index(InLine, (tabchar)) > 0) then
  57.         do
  58.             if firstline = 1 then
  59.             do
  60.                 firstline = 0
  61.                 parse var InLine FirstName (tabchar) LastName (tabchar) City (cr) (lf)
  62.             end
  63.             else
  64.             do
  65.                 parse var InLine (lf) FirstName (tabchar) LastName (tabchar) City (cr) (lf)
  66.             end
  67.  
  68.             writech('outhandle', FirstName LastName cr)
  69.  
  70.             NEW 'FIRST="'FirstName'" NAME="'LastName'" CITY="'City'"'
  71.  
  72.         end
  73.         else
  74.         do
  75.             writech('outhandle', '*** no data ***' cr)
  76.         end
  77.     end
  78.  
  79.     close ('imfh')
  80.  
  81. end
  82.  
  83.